import 'package:flutter/material.dart';

class DialogCheckBox extends StatefulWidget {
  const DialogCheckBox({Key? key, this.value, required this.onChanged})
      : super(key:key);

  final ValueChanged<bool?> onChanged;
  final bool? value;

  @override
  _DialogCheckBoxState createState() => _DialogCheckBoxState();
}

class _DialogCheckBoxState extends State<DialogCheckBox>{
  bool? value;

  @override
  void initState() {
    value = widget.value;
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Checkbox(
        value:value,
        onChanged: (v) {
          widget.onChanged(v);
          setState(() => value = v);
        }
    );
  }
}